#include <iostream>
#include <unordered_map>
using namespace std;

const int N = 1e6 + 10,M = 2e3 + 10;
int n,m,kind = 0;
int a[N];
int mp[M];

int main()
{
    cin >> n >> m;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    int left = 1,right = 1;
    int ret = n,begin = 1;
    while(right <= n)
    {
        if(mp[a[right]]++ == 0)
        {
            kind++;
        }
        while(kind == m)
        {
            int len = right - left + 1;
            if(len < ret)
            {
                ret = len;
                begin = left;
            }
            if(mp[a[left]]-- == 1)
            {
                kind--;
            }
            left++;
        }
        right++;
    }
    cout << begin << " " << begin + ret - 1 << endl;


    return 0;
}